package com.webware.view.client.ui;

import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.event.logical.shared.HasValueChangeHandlers;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.DockLayoutPanel;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.FormPanel;
import com.google.gwt.user.client.ui.SuggestBox;
import com.webware.view.client.presenter.Presenter;

public class HeaderViewImpl extends Composite implements HeaderView {
    private Presenter presenter;
    private SuggestBox searchBox;
    private Button submitButton;

    public HeaderViewImpl() {
	DockLayoutPanel panel = new DockLayoutPanel(Unit.PCT);

	FormPanel form = new FormPanel("");
	form.setMethod("get");
	form.setAction("");

	FlowPanel flow = new FlowPanel();
	form.add(flow);

	searchBox = new SuggestBox();
	searchBox.setFocus(true);
	searchBox.getElement().setPropertyString("placeholder", "Поиск");
	flow.add(searchBox);

	submitButton = new Button();
	flow.add(submitButton);

	panel.addWest(form, 50);
	initWidget(panel);
    }

    public void setPresenter(Presenter presenter) {
	this.presenter = presenter;
    }

    public HasValueChangeHandlers<String> getSearchBox() {
	return searchBox;
    }

    public HasClickHandlers getSubmitButton() {
	return submitButton;
    }
}
